package exam.meituan.T1;

import java.util.Scanner;


public class Main {

    public static int n = 0;
    public static int m = 0;
    public static int[] price1;
    public static int[] price2;
    public static Man[] mans;
    public static int sumPrice1 = 0;
    public static int sumPrice2 = 0;
    public static int manIdx = 0;
    public static StringBuilder res = new StringBuilder();

    static class Man {
        int c;
        int d;
    }


    public static void main(String[] args) {
        inputParams();
        for (int i=0; i<n; ++i) {
            res.append(solution(i));
        }
        System.out.println(res.toString());
    }

    public static void inputParams() {
        Scanner sc = new Scanner(System.in);
        n = sc.nextInt();
        price1 = new int[n];
        price2 = new int[n];
        for (int i=0; i<n; ++i) {
            price1[i] = sc.nextInt();
        }
        for (int i=0; i<n; ++i) {
            price2[i] = sc.nextInt();
        }
        m = sc.nextInt();
        mans = new Man[m];
        for (int i=0; i<m; ++i)
            mans[i] = new Man();
        for (int i=0; i<m; ++i) {
            mans[i].c = sc.nextInt();
        }
        for (int i=0; i<m; ++i) {
            mans[i].d = sc.nextInt();
        }
    }

    public static char solution(int i) {
        sumPrice1 += price1[i];
        sumPrice2 += price2[i];
        int manPrice = sumPrice1;
        if (sumPrice1 == mans[manIdx].c) {
            manPrice = sumPrice1 - mans[manIdx].d;
        } else if (sumPrice1 > mans[manIdx].c) {
            while (manIdx+1 < m) {
                if (mans[manIdx+1].c > sumPrice1)
                    break;
                manIdx++;
            }
            manPrice = sumPrice1 - mans[manIdx].d;
        }

        if (manPrice == sumPrice2)
            return 'B';
        else if (manPrice < sumPrice2)
            return 'M';
        else
            return 'Z';
    }
}
